var mod_race = mod_fwk_base.extend({
	//idAttribute : 'id_race',
	defaults: function(){
		return {
			//'name': 'race ' + new Date().format('fullDate'),
			'name': '',
			'venue': '',
			'date': new Date().getTime(),
			'note': '',
			'cars': new Array(),
			'entries': new Array(),
			'result': 'on-going',
			'type': 'technical',
			'dateCreate': new Date().getTime(),
			'dateMod': new Date().getTime()
		};
	},
	store: null,
	initialize: function(){
		this.store = __app.colls.races.store;
		//this.bind('change', this.setDateMod);
	},
	type: function(){
		return __app.lists.raceTypes[this.attributes['type']];
	},
	result: function(){
		return __app.lists.raceResultTypes[this.attributes['result']];
	},
	validate: function(attrs, options){
	    var errors = new Array();
	    if(attrs['name'] == null){
	        errors.push({name: 'name', message: 'please enter a race name'});
	    }
	    if(attrs['venue'] == null){
	         errors.push({name: 'venue', message: 'please enter a race venue'});
	    }
	    
	    if(errors.length > 0){
	        return errors;
	    }
	}
});

